# 测试后台审核文章测试用例
import time

import pytest

from config import BaseDir
from page.BackPage.PageAudit import AuditProxy
from page.BackPage.PageHome import HomeProxy
from page.BackPage.PageLogin import LoginProxy

from utils import UtilsDriver, get_case_data

audit_data = get_case_data(BaseDir + "/data/BackJson/article_audit.json")


@pytest.mark.run(order=1002)
class TestBackAudit:
    # 定义类级别的fixture初始化方法
    def setup_class(self):
        # self.login_proxy = LoginProxy()
        self.home_proxy = HomeProxy()
        self.audit_proxy = AuditProxy()

    #     定义类级别的fixture销毁方法
    def teardown_class(self):
        UtilsDriver.quit_back_driver()

    @pytest.mark.parametrize("title,status,end_time", audit_data)
    def test_audit(self, title, status, end_time):
        self.home_proxy.go_content_audit()
        self.audit_proxy.audit_article(title, status, end_time)
        result = self.audit_proxy.success_audit_article(title)
        assert result
